<?php
namespace Common\Model;
use Think\Model;
/*
 * 模板管理模型
 */
class TemplateModel extends Model {
    protected $tableName = 'system_template';

    public function getContent($alias,$type=2,$con='content'){
        $list = S($type.'_template_cache_'.$con);
        if(!$list){
            $map['type'] = $type;
            $data = M('system_template')->where($map)->field(true)->select();
            $list = array();
            foreach($data as $val){
                $list[$val['alias']]['content'] = $val[$con];
                $list[$val['alias']]['send_type'] = $val['type'];
            }
            S($type.'_'.$con.'_template_cache_'.$con,$list);
        }

        return $list[$alias];
    }
}
?>
